package com.svse.entity;

import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Copyright 上海危网信息科技有限公司版权所有
 * @company wwsoft
 * @time 2019/9/3 17:30
 */

public class EmpEntity implements Serializable {

    private static final long serialVersionUID = -176271593732292209L;
    /**
     * 主键ID
     */
    private int eid;
    /**
     * 姓名
     */
    @NotNull(message = "名字不能为空")
    private String ename;
    /**
     * 爱好
     */
    private String ehob;
    /**
     * 年龄
     */
    @Max(value = 100, message = "年龄有点大哟")
    @Min(value = 0, message = "年龄有问题")
    private int age;

    /**
     * 性别
     */
    @Range(min = 0, max = 1, message = "性别验证不通过")
    private int sex;
    @Pattern(regexp = "^\\s*|((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\\d{8}$", message = "手机号验证不通过")
    private String mobile;
    /**
     * 对Integer类型不能使用@NotBlank验证
     */
    @NotNull(message = "人员状态不能为空")
    private Integer status;


    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;


    public int getEid() {
        return eid;
    }

    public void setEid(int eid) {
        this.eid = eid;
    }

    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public String getEhob() {
        return ehob;
    }

    public void setEhob(String ehob) {
        this.ehob = ehob;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @Override
    public String toString() {
        return "EmpEntity{" +
                "eid=" + eid +
                ", ename='" + ename + '\'' +
                ", ehob='" + ehob + '\'' +
                ", age=" + age +
                ", sex=" + sex +
                ", mobile='" + mobile + '\'' +
                ", status=" + status +
                ", birthday=" + birthday +
                '}';
    }
}
